413A - Data Recovery - CodeForces Solution


implementation *1200

Please click on ads to support us..

Python Code:

I=lambda:list(map(int,input().split()))
n,m,N,X=I()
t=I()
r=min(t)!=N
r+=max(t)!=X
print(['C','Inc'][m+r>n or min(t)<N or max(t)>X]+'orrect')

C++ Code:

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,minimum,maximum;
	cin>>n>>m>>minimum>>maximum;
	int arr[m];
	for(int i=0;i<m;i++)
	{
		cin>>arr[i];

	}
	sort(arr,arr+m);
	int diff=n-m;
	int mi=arr[0];
	int ma=arr[m-1];


	if(minimum>mi||maximum<ma)
		cout<<"Incorrect";
	else
	{
	if(diff>=2)
		cout<<"Correct";
	else
	{
		
		if(diff==1)
		{
			if(mi==minimum||ma==maximum)
				cout<<"Correct";
			else
				cout<<"Incorrect";

		}
		else if(diff==0)
		{
			if(mi==minimum&&ma==maximum)
				cout<<"Correct";
			else
				cout<<"Incorrect";
		}

	}
}
}


Comments

Submit
0 Comments
More Questions

1337B - Kana and Dragon Quest game
137C - History
1443C - The Delivery Dilemma
6C - Alice Bob and Chocolate
1077C - Good Array
285B - Find Marble
6A - Triangle
1729A - Two Elevators
1729B - Decode String
1729C - Jumping on Tiles
1729E - Guess the Cycle Size
553B - Kyoya and Permutation
1729D - Friends and the Restaurant
1606C - Banknotes
580C - Kefa and Park
342A - Xenia and Divisors
1033A - King Escape
39D - Cubical Planet
1453A - Cancel the Trains
645A - Amity Assessment
1144A - Diverse Strings
1553B - Reverse String
1073A - Diverse Substring
630N - Forecast
312B - Archer
34D - Road Map
630I - Parking Lot
160B - Unlucky Ticket
371B - Fox Dividing Cheese
584B - Kolya and Tanya